move all occurrences of element to the end of linked list